package com.bjsxt;

import java.util.HashSet;
import java.util.Set;

public class TestBabys {
    public static void main(String[] args) {
        //实例化HashSet
        Set<Babys> set = new HashSet<>();
        //创建对象
        Babys b = new Babys("hua",28);
        Babys b1 = new Babys("li",30);
        Babys b2 = new Babys("li",30);
        //添加到HashSet容器
        set.add(b);
        set.add(b1);
        set.add(b2);
        //遍历
        System.out.println(b.hashCode());
        System.out.println(b1.hashCode());
        System.out.println(b2.hashCode());
        for(Babys babys: set){
            System.out.println(babys);
        }

    }
}
